-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use adafruit_ticks.ticks_ms for scrolling_label animation #208
Conversation
The CI didn't like including supervisor. I don't know if that can be fixed in the requirements/toml/??? files somewhere or if it's a bigger issue with the approach. |
I think the step that is failing is the docs build. If you add
|
That did the trick 😁 Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned by Dan in the referenced issue, another option would be to use time.monotonic_ns and similarly watch for the rollover, however apparently not all boards support the monotonic_ns method.
A small number of SAMD21 ("M0") boards support displayio
, but don't support longints and therefore don't support monotonic_ns
.
One issue is that supervisor.ticks_ms
is not implemented by Blinka, which would make this not usable if used under Blinka.
I think the solution is to use https://github.com/adafruit/Adafruit_CircuitPython_ticks instead of using supervisor.ticks_ms()
directly. The adafruit_ticks library
chooses the ticks mechanism based on what is available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
Updating https://github.com/adafruit/Adafruit_CircuitPython_DS248x to 1.0.1 from 1.0.0: > Update ds248x_simpletest.py Updating https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI to 8.4.0 from 8.3.1: > Merge pull request adafruit/Adafruit_CircuitPython_ESP32SPI#209 from justmobilize/add-ap-info Updating https://github.com/adafruit/Adafruit_CircuitPython_ConnectionManager to 3.1.1 from 3.1.0: > Merge pull request adafruit/Adafruit_CircuitPython_ConnectionManager#21 from justmobilize/update-wiznet-version-check Updating https://github.com/adafruit/Adafruit_CircuitPython_Display_Text to 3.1.2 from 3.1.1: > Merge pull request adafruit/Adafruit_CircuitPython_Display_Text#208 from RetiredWizard/monoprecision Updating https://github.com/adafruit/Adafruit_CircuitPython_Requests to 4.1.1 from 4.0.0: > Merge pull request adafruit/Adafruit_CircuitPython_Requests#195 from DJDevon3/main > Merge pull request adafruit/Adafruit_CircuitPython_Requests#194 from justmobilize/post-file-as-data Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA: > Added the following libraries: Adafruit_CircuitPython_S35710, Adafruit_CircuitPython_HX711 Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA: > Updated download stats for the libraries
As described in adafruit/circuitpython#5411 time.monotonic loses precision over time, which eventually causes the scrolling_label animation to occur every time an update method is called. This can result in the scrolling text suddenly speeding up dramatically.
This PR uses supervisor.ticks_ms and adds a bit of logic to watch for the value rolling over instead of time.monotonic() which should resolve the issue. As mentioned by Dan in the referenced issue, another option would be to use time.monotonic_ns and similarly watch for the rollover, however apparently not all boards support the monotonic_ns method.